50f9085b2a09b29aec558432e59116aa493480e1,platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java,JobUtilTest,checkProgressAndReadAction,#List#DaemonProgressIndicator#boolean#,172
Before Change
final DaemonProgressIndicator progress,
final boolean runInReadAction) throws Throwable {
final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, progress, runInReadAction, new Processor<Object>() {
@Override
public boolean process(Object o) {
try {
if (objects.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= JobLauncherImpl.CORES_FORK_THRESHOLD) {
assertTrue(ApplicationManager.getApplication().isDispatchThread());
}
else {
// generally we know nothing about current thread since FJP can help others task to execute while in current context
}
ProgressIndicator actualIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progress == null) {
assertNotNull(actualIndicator);
assertTrue(actualIndicator instanceof AbstractProgressIndicatorBase);
}
else {
assertTrue(actualIndicator instanceof SensitiveProgressWrapper);
ProgressIndicator original = ((SensitiveProgressWrapper)actualIndicator).getOriginalProgressIndicator();
assertSame(progress, original);
}
// there can be read access even if we didn't ask for it (e.g. when task under read action steals others work)
assertTrue(!runInReadAction || ApplicationManager.getApplication().isReadAccessAllowed());
}
catch (Throwable e) {
exception.set(e);
}
return true;
}
});
if (exception.get() != null) throw exception.get();
}
After Change
final DaemonProgressIndicator progress,
final boolean runInReadAction) throws Throwable {
final AtomicReference<Throwable> exception = new AtomicReference<>();
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, progress, runInReadAction, o -> {
try {
if (objects.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= JobLauncherImpl.CORES_FORK_THRESHOLD) {
assertTrue(ApplicationManager.getApplication().isDispatchThread());
}
else {
// generally we know nothing about current thread since FJP can help others task to execute while in current context
}
ProgressIndicator actualIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progress == null) {
assertNotNull(actualIndicator);
assertTrue(actualIndicator instanceof AbstractProgressIndicatorBase);
}
else {
assertTrue(actualIndicator instanceof SensitiveProgressWrapper);
ProgressIndicator original = ((SensitiveProgressWrapper)actualIndicator).getOriginalProgressIndicator();
assertSame(progress, original);
}
// there can be read access even if we didn't ask for it (e.g. when task under read action steals others work)
assertTrue(!runInReadAction || ApplicationManager.getApplication().isReadAccessAllowed());
}
catch (Throwable e) {
exception.set(e);
}
return true;
});
if (exception.get() != null) throw exception.get();
}